<template>
  <div class="sele">
    <div
      v-for="(item, index) in but"
      :class="index == 0 ? 'but bColor' : 'but'"
      :key="item.id"
    >
      <span class="name">{{ item.name }}</span>
      <span><img :src="item.imges" /></span>
      <span class="num">{{ sButArr[index] + " " + funA(item.id) }}</span>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    sButArr: {
      type: Array(),
      default() {
        return [35, 36, 50, 62, 88, 61];
      },
    },
  },
  data() {
    return {
      but: [
        {
          id: 1,
          name: "室内温度",
          imges: require("../img/shouye21.png"),
        },
        {
          id: 2,
          name: "室外温度",
          imges: require("../img/shouye18.png"),
        },
        {
          id: 3,
          name: "室内湿度",
          imges: require("../img/shouye24.png"),
        },
        {
          id: 4,
          name: "室外湿度",
          imges: require("../img/shouye24.png"),
        },
        {
          id: 5,
          name: "光照强度",
          imges: require("../img/shouye26.png"),
        },
        {
          id: 6,
          name: "土壤湿度",
          imges: require("../img/shouye29.png"),
        },
      ],
    };
  },
  computed: {},
  watch: {},
  methods: {
    funA(id) {
      if (id == 1 || id == 2) {
        return "℃";
      } else if (id == 3 || id == 4 || id == 6) {
        return "%";
      } else if (id == 5) {
        return "lux";
      }
    },
  },
};
</script>

<style lang="less" scoped>
.sele {
  padding-bottom: 24px;
  display: flex;
  justify-content: space-between;
}
/deep/ .bColor {
  background-color: #5671fc !important;
  color: #fffffd !important;
}
.but {
  width: 168px;
  height: 86px;
  border-radius: 8px;
  background-color: #ffffff;
  color: #47547c;
  text-align: center;
  display: flex;
  align-content: center;
  justify-content: center;
  flex-wrap: wrap;
  box-shadow: 0 0 10px 0 rgba(156, 158, 158, 0.5);

  .name {
    width: 100%;
    font-size: 14px;
  }
  img {
    padding-top: 7px;
    padding-right: 8px;
  }
  .num {
    padding-top: 6px;
    font-size: 22px;
  }
}
</style>